class CopyrightWebpackPlugin {
    constructor(props) {
        console.log("这里开始使用插件", props)
    }

    apply(compiler) {

        compiler.hooks.compile.tap('CopyrightWebpackPlugin', () => {
            console.log("同步执行，compile")
            console.warn("%c ----- %d", 'color:blue', Date.now())
        })

        // 
        compiler.hooks.emit.tapAsync('CopyrightWebpackPlugin', (compilation, cb) => {
            compilation.assets['copyright.txt'] = {
                source: function () {
                    return "copyright.txt"
                },
                size: function () {
                    return 5;
                }
            }
            cb();
        })
    }
}

module.exports = CopyrightWebpackPlugin;